package learnJava.puzzlers;

public class CharPuzzlers {
    public static class EscapeRout{

        public static void main(String[] args) {
            // \u0022 is Unicode escape for double quote"
            // 这里的 \u0022 会被编译器识别为"而不是\"
            System.out.println("a\u0022.length()+\u0022b".length());
            //下面是编译器生成的语句
            // System.out.println("a".length() + "b".length());
        }
    }
    public static class StringCheese{
        public static void main(String[] args) {
            byte bytes[] = new byte[256];
            for (int i =0;i<256;i++)
                bytes[i] = (byte)i;
            String str = new String(bytes);
            for (int i = 0;i<str.length();i++)
                System.out.println((int)str.charAt(i)+" ");
        }
    }

    public static class Rhymes{
        public static void main(String[] args) {
            // 这里条用的是StringBuffer(int)构造函数，
            // StringBuffer没有StringBuffer(char)构造函数
            // 所以会将'A'转换成（int）'A'
            StringBuffer sb = new StringBuffer('A');
            sb.append("BC");
            System.out.println(sb);
        }
    }
}
